package com.five.admin.server.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.five.admin.mapper.ProductMapper;
import com.five.pojo.vo.MobileProductListVo;
import com.five.service.ProductRpcService;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;
import java.util.List;

@DubboService(interfaceClass = ProductRpcService.class)
public class ProductRpcServiceImpl implements ProductRpcService {

    @Resource
    private ProductMapper productMapper;
    @Override
    public MobileProductListVo listProductsById(Long id) {
        MobileProductListVo mobileProductListVo = productMapper.listProductById(id);
        mobileProductListVo.setImages(productMapper.queryImagesByProductId(id));
        return mobileProductListVo;

    }

    @Override
    public List<MobileProductListVo> Top10Products() {
        List<MobileProductListVo> top10List = productMapper.listProducts();
        return top10List;
    }

    @Override
    public List<MobileProductListVo> queryProductByCategoryId(Long categoryId) {
        return productMapper.queryProductByCategoryId(categoryId);
    }

    @Override
    public List<MobileProductListVo> queryProductByProductName(String productName) {
        return productMapper.queryProductByProductName(productName);
    }


}
